import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public  class  ParkingSystem  implements  IParking {
    int sb;
    int sm;
    int ss;

    public ParkingSystem(int big, int medium, int small) {
        sb = big;
        sm = medium;
        ss = small;
    }

    public static void main(String[] args) throws Exception {
        IParams params = IParking.parse();//ParkingSystem.parse();

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入初始车位");
        System.out.println("大型车位");
        int b = scanner.nextInt();
        System.out.println("中型车位");
        int m = scanner.nextInt();
        System.out.println("小型车位");
        int s = scanner.nextInt();

        ParkingSystem ps = new ParkingSystem(b,m,s);

        ArrayList<Integer> plan = params.getPlanParking();

        while (true) {
            System.out.println("车辆入库");
            int i = scanner.nextInt();
            if(i == 1) {
                plan.add(1);
            } else if(i == 2) {
                plan.add(2);
            } else if(i == 3) {
                plan.add(3);
            } else {
                break;
            }
        }


        for (int i = 0; i < plan.size(); i++) {
            ps.addCar(plan.get(i));
        }
        ps.print();
    }

    @Override
    public void print() {
        System.out.printf("大型车位剩余："+sb+"中型车位剩余："+sm+"小型车位剩余："+ss);
    }

    @Override
    public boolean addCar(int carType) {
        int count = 0;
        if(carType == 1 && sb > 0) sb--;
        else if(carType == 2 && sm > 0) sm--;
        else if(carType == 3 && ss > 0) ss--;
        else return false;
        return true;
    }
}